package com.hackordie.bindables;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import org.hibernate.annotations.Check;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

import com.hackordie.commons.authorities.User;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType
@XmlRootElement
public class BindableSignin {

	@XmlElement
	@NotEmpty
	private String username;

	@XmlElement
	@NotEmpty
	private String password;

	@XmlElement
	@NotEmpty
	private String re_password;

	@XmlElement
	@NotEmpty
	@Email
	private String email;

	@XmlElement
	@NotEmpty
	@Check(constraints = "true")
	private String terms;

	public BindableSignin() {

	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getRe_password() {
		return re_password;
	}

	public void setRe_password(String re_password) {
		this.re_password = re_password;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getTerms() {
		return terms;
	}

	public void setTerms(String terms) {
		this.terms = terms;
	}

	public User toUser() {
		User user = new User(username,password,email);
		return user;
	}

}